package testJdk.commonUse.array;

import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @version 1.0.0
 * Created by cyd on 2022-10-19 10:33:12
 * @ClassName : learn_jdk.commonUse.array.ArrayTrans
 * @Description : 类描述
 */
public class ArrayTrans {

    /**
     * 字符串数组转化为数字数组
     *
     */
    @Test
    public void test01() {
        String strings = "123,456,789";
        List<Long> longs = Arrays.stream(strings.split(","))
                .map(Long::valueOf)
                .collect(Collectors.toList());
        System.out.println(longs);
        ArrayList<Long> longs1 = Lists.newArrayList(longs);
        System.out.println(longs1);
    }
}
